home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue35 / clinic / BmpUserU.pas < prev    next >
Pascal/Delphi Source File  |  1998-03-11  |  1KB  |  63 lines

  1. unit BmpUserU;
  2.  
  3. interface
  4.  
  5. uses
  6.   WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  7.   Dialogs, ExtCtrls, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Image1: TImage;
  12.     Button1: TButton;
  13.     Button2: TButton;
  14.     procedure FormCreate(Sender: TObject);
  15.     procedure FormDestroy(Sender: TObject);
  16.     procedure Button1Click(Sender: TObject);
  17.     procedure Button2Click(Sender: TObject);
  18.   private
  19.     { Private declarations }
  20.   public
  21.     DLLHandle: THandle;
  22.   end;
  23.  
  24. var
  25.   Form1: TForm1;
  26.  
  27. implementation
  28.  
  29. uses
  30.   ResConst;
  31.  
  32. {$R *.DFM}
  33.  
  34. procedure TForm1.FormCreate(Sender: TObject);
  35. begin
  36.   DLLHandle := LoadLibrary('ResLib.Dll');
  37.   if DLLHandle < HInstance_Error then
  38. {$ifdef Win32}
  39.     RaiseLastWin32Error;
  40. {$else}
  41.     raise Exception.Create('Could not load resource DLL')
  42. {$endif}
  43. end;
  44.  
  45. procedure TForm1.FormDestroy(Sender: TObject);
  46. begin
  47.   FreeLibrary(DLLHandle)
  48. end;
  49.  
  50. procedure TForm1.Button1Click(Sender: TObject);
  51. begin
  52.   Image1.Picture.Bitmap.Handle :=
  53.     LoadBitmap(DLLHandle, MakeIntResource(bmpAthena))
  54. end;
  55.  
  56. procedure TForm1.Button2Click(Sender: TObject);
  57. begin
  58.   Image1.Picture.Bitmap.Handle :=
  59.     LoadBitmap(DLLHandle, PChar(bmpChemical))
  60. end;
  61.  
  62. end.
  63.